639A - Bear and Displayed Friends - CodeForces Solution


implementation *1200

Please click on ads to support us..

Python Code:

n, k, q = map(int, input().split())
t = list(map(int, input().split()))

s = set()
l = [0] * k

c, m = 0, 0

for i in range(q):
	x, y = map(int, input().split())
	
	if x == 1:
		c += 1
		s.add(y)
		
		l[0] = max(t[y - 1], l[0])
		l.sort()
	else:
		if y not in s:
			print("NO")
		
		elif c < k:
			print("YES")
		
		elif t[y - 1] >= l[0]:
			print("YES")
		else:
			print("NO")


Comments

Submit
0 Comments
More Questions

855B - Marvolo Gaunt's Ring
1454A - Special Permutation
1359A - Berland Poker
459A - Pashmak and Garden
1327B - Princesses and Princes
1450F - The Struggling Contestant
1399B - Gifts Fixing
1138A - Sushi for Two
982C - Cut 'em all
931A - Friends Meeting
1594A - Consecutive Sum Riddle
1466A - Bovine Dilemma
454A - Little Pony and Crystal Mine
2A - Winner
1622B - Berland Music
1139B - Chocolates
1371A - Magical Sticks
1253A - Single Push
706B - Interesting drink
1265A - Beautiful String
214A - System of Equations
287A - IQ Test
1108A - Two distinct points
1064A - Make a triangle
1245C - Constanze's Machine
1005A - Tanya and Stairways
1663F - In Every Generation
1108B - Divisors of Two Integers
1175A - From Hero to Zero
1141A - Game 23